<?php
$css = ['/assets/jedate/skin/jedate.css'];
$this->load->view('admin/layout/head', array('title'=>"退款管理",'nav'=>'order','css'=>$css), FALSE);
?>

<div id="container">
	<form class="form-inline" id="search-form" method="GET" action="">
	  <div class="form-group">
	  	<select name="pay_mode" id="type_slt" class="form-control">
	  		<option value="">退款方式</option>
	  		<option value="0">退至账户余额</option>
	  		<option value="1">现金退款</option>
	  	</select>
	  	<input type="text" name="start_date" class="form-control date-picker" value="<?= $this->input->get('start_date') ?>" placeholder="起始日期">
	  	<input type="text" name="end_date" class="form-control date-picker" value="<?= $this->input->get('end_date') ?>" placeholder="结束日期">
	  </div>

	  <div class="form-group">
	  	<input type="text" name="order_id" class="form-control" value="<?= $this->input->get('order_id') ?>" placeholder="订单号">
	  </div>
	  <button class="btn btn-info search-btn">搜索</button>
	</form>
	<div class="table-container mt-10">
		<table class="table table-bordered table-striped table-hover scroll-table">
			<thead >
				<tr>
					<th class="text-center">退货单号</th>
					<th class="text-center">订单号</th>
					<th class="text-center">日期</th>
					<th class="text-center">会员</th>
					<th class="text-center">退款方式</th>
					<th class="text-center">退款金额</th>
					<th class="text-center">上次余额</th>
					<th class="text-center">当前余额</th>
					<th class="text-center">vat</th>
					<th class="text-center">是否货损</th>
					<th class="text-center">操作</th>
				</tr>
			</thead>
			<tbody class="text-center">
				<?php foreach ($page as $key => $value): ?>
					<tr id="<?= $value['id'] ?>">
						<td><?= $value['id'] ?></td>
						<td><?= $value['order']['order_id'] ?></td>
						<td><?= $value['create_time'] ?></td>
						<td><?= $value['user'] ? $value['user']['last_name'].$value['user']['first_name']."/{$value['user']['phone']}" : '' ?></td>
						<td><?= $pay_types[$value['pay_mode']][$this->session->admin_language] ?></td>
						<td><?= $value['money'] ?></td>
						<td><?= $value['last'] ?></td>
						<td><?= $value['now'] ?></td>
						<td><?= $value['vat'] ?></td>
						<td><?= $value['is_damaged'] ? '是' : '否' ?></td>
						<td>
							<a href="<?= site_url('admin/refund/detail/'.$value['id']) ?>">详情</a>
						</td>
					</tr>
				<?php endforeach ?>
			</tbody>
			<?php if ($page->last_page>1): ?>
				<tfoot>
					<td colspan="10" style="text-align:right">
						<?php echo $page->render() ?>
					</td>
				</tfoot>
			<?php endif ?>
		</table>
	</div>
</div>


<?php
$js = ['/assets/jedate/jedate.min.js'];
$this->load->view('admin/layout/footer',['js'=>$js]);
?>
<script type="text/javascript">
	datepicker('.date-picker','<?php echo $this->session->admin_language ?>');
</script>
